<div class="span7">
	<div id="Blog1" class="widget Blog">
		<div class="blog-posts hfeed">
		<?php if (isset($post)) :?>
			<div class="date-outer">
				<div class="date-posts">
					<div class="post-outer">
						<div class="post hentry" itemtype="http://schema.org/BlogPosting" itemscope="itemscope" itemprop="blogPost">
							<h2 class="post-title entry-title">
								<?php echo $post->title ?>
							</h2>
							<div class="post-header">
								<div class="post-header-line-1"></div>
								<span class="post-author vcard">
									Posted by <span class="fn">Admin</span>
								</span>	
								<span class="post-timestamp">
									at <span class="fn"><?php echo substr($post->created_on, 0,10) ?></span>
									<a id="like" href="#" class="btn btn-primary" onclick="like(<?php echo $post->id?>)">Like</a>
								</span>
							</div>
							<div trbidi="on" style="text-align: left;" dir="ltr">
								<div class="post-header" style="clear: both; text-align: center;">
									<iframe width="700" height="350" src="http://www.youtube.com/embed/<?php echo $post->url?>?rel=0" frameborder="0" allowfullscreen></iframe>
								</div>
								<div class="post-header">
									<?php  
									$desc = strip_tags($post->description);
									echo $desc; 
									?>
								</div>
							</div>
							<div style="clear: both;"></div>
						</div>
					</div>
				</div>
			</div>
			<?php else : ?>
			      	<h3>No Posts were found.</h3>
		<?php endif; ?> 	
		</div>
	</div>
</div>
<div class="span4">
	<table>
		<h2>Most viewed</h2>
		<?php if(!empty($viewed)):?>
			<?php foreach($viewed as $view):?>
			<tr>
				<td style="float:left">
					<a href="<?php echo site_url('blog/view/'.$view->id)?>"><h3><?php echo $view->title?></h3>
						<img width="170" height="150" alt="" src="http://img.youtube.com/vi/<?php echo $view->url?>/mqdefault.jpg">
					</a>
				</td>
			</tr>
			<?php endforeach;?>
		<?php else:?>
		<tr>
			<td style="float:left">
				Their is no liked video.
			</td>
		</tr>
		<?php endif;?>	
	</table>
	<table>
		<h2>Most liked</h2>
		<?php if(!empty($liked)):?>
			<?php foreach($liked as $like):?>
			<tr>
				<td style="float:left">
					<a href="<?php echo site_url('blog/view/'.$like->id)?>"><h3><?php echo $like->title?></h3>
						<img width="170" height="150" alt="" src="http://img.youtube.com/vi/<?php echo $like->url?>/mqdefault.jpg">
					</a>
				</td>
			</tr>
			<?php endforeach;?>
		<?php else:?>
			<tr>
				<td style="float:left">
					Their is no liked video.
				</td>
			</tr>
		<?php endif;?>
	</table>
</div>




<script>
	function like(id)
	{
		jQuery.post('<?php echo site_url("blog/like")?>'+'/'+id,function(data) {
				
		});
	}	
</script>
